﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LibMinecraft.Server;
using LibMinecraft.Model;

namespace PartyCraftServer.Commands
{
    public class WorldCommand : Command
    {
        public override bool RequiresOp
        {
            get { return false; }
        }

        public override string DefaultCommand
        {
            get { return "world"; }
        }

        public override string Documentation
        {
            get { return "Manages multiple worlds on the same server.\nUsage: /world [new|*]"; } // TODO: Named worlds
        }

        public override void ExecuteCommand(RemoteClient client, params string[] parameters)
        {
            if (parameters[0] == "new")
            {
                PartyCraft.Server.AddWorld(new World());
                PartyCraft.Server.SendChatToPlayer(client.PlayerEntity.Name, "World #" + 
                    (PartyCraft.Server.Worlds.Count - 1) + " has been created.");
                return;
            }
            client.PlayerEntity.WorldIndex = int.Parse(parameters[0]);
        }
    }
}
